<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>星梦小铺后台管理系统</title>
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="../css/font-awesome/css/font-awesome.min.css"
	rel="stylesheet">
<!-- NProgress -->
<link href="../css/nprogress/nprogress.css" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="../css/custom.min.css" rel="stylesheet">
<style type="text/css">
.x_content form ul {
	list-style: none;
}

.x_content form ul li {
	width: 350px;
	display: inline-block;
	height: 40px;
	line-height: 40px;
	vertical-align: middle;
}

.tooltip {
	z-index: 9999999999;
}

.dropdown-menu {
	min-width: 105px;
}
</style>
<script src="../js/jquery-1.12.4.js"></script>
</head>

<body class="nav-md">
	<div class="container body">
		<div class="main_container">
			<%@include file="header.jsp"%>
			<!-- page content -->
			<div class="right_col" role="main">
				<div class="row">
					<div class="col-md-12">
						<div class="x_panel">
							<div class="x_title">
								<h2>
									商品列表维护 <i class="fa fa-user"></i><small>当前操作用户-您可以通过搜索或者其他的筛选项对用户的信息进行修改、删除等管理操作。^_^</small>
								</h2>
								<div class="clearfix"></div>
							</div>
							<div class="x_content">
								<form id="form1" method="post" action="chaxunshangpin">
									<input type="hidden" id="pageno" name="pageno" />
									<ul>
										<li>
											<div class="form-group">
												<label class="control-label col-md-3 col-sm-3 col-xs-12">商品标题</label>
												<div class="col-md-6 col-sm-6 col-xs-12">
													<input name="queryTitle" type="text"
														class="form-control col-md-7 col-xs-12"
														value="${queryTitle}">
												</div>
											</div>
										</li>
										<li>
											<div class="form-group">
												<label class="control-label col-md-3 col-sm-3 col-xs-12">商品类型</label>
												<div class="col-md-6 col-sm-6 col-xs-12">
													<select id="ntid" name="ntid"
														class="form-control col-md-7 col-xs-12">
														<option value="0">--请选择类型--</option>
														<script type="text/javascript">
															$(function() {
																$
																		.getJSON(
																				"type",
																				function(
																						typelist) {
																					//用于将符合标准格式的的JSON字符串转为与之对应的JavaScript对象			  
																					//var flalist=$.parseJSON(result);
																					for ( var i in typelist) {
																						$(
																								"#ntid")
																								.append(
																										"<option  value=\""+typelist[i].typeid+"\">"
																												+ typelist[i].type
																												+ "</option>");
																						/* $("#flav").append("1"); */
																					}
																				});
															});
														</script>

													</select>
												</div>
											</div>
										</li>

										<li><button type="submit" class="btn btn-primary">
												查 &nbsp;&nbsp;&nbsp;&nbsp;询</button></li>
									</ul>
								</form>
							</div>
						</div>
					</div>

					<div class="col-md-12 col-sm-12 col-xs-12">
						<div class="x_panel">
							<div class="x_content">
								<p class="text-muted font-13 m-b-30"></p>
								<div id="datatable-responsive_wrapper"
									class="dataTables_wrapper form-inline dt-bootstrap no-footer">
									<div class="row">
										<div class="col-sm-12">
											<a href="newsadd.jsp" class="btn btn-success btn-sm"
												target="_blank">商品</a>
											<table id="datatable-responsive"
												class="table table-striped table-bordered dt-responsive nowrap dataTable no-footer dtr-inline collapsed"
												role="grid" aria-describedby="datatable-responsive_info"
												style="width: 100%;">
												<thead>
													<tr role="row">
														<th class="sorting_asc" tabindex="0"
															aria-controls="datatable-responsive" rowspan="1"
															colspan="1"
															aria-label="First name: activate to sort column descending"
															aria-sort="ascending">商品名</th>
														<th class="sorting" tabindex="0"
															aria-controls="datatable-responsive" rowspan="1"
															colspan="1"
															aria-label="Last name: activate to sort column ascending">
															商品单价</th>
														<th class="sorting" tabindex="0"
															aria-controls="datatable-responsive" rowspan="1"
															colspan="1"
															aria-label="Last name: activate to sort column ascending">
															商品详情</th>
														<th class="sorting" tabindex="0"
															aria-controls="datatable-responsive" rowspan="1"
															colspan="1" style="width: 124px;"
															aria-label="Last name: activate to sort column ascending">
															操作</th>
													</tr>
												</thead>
												<tbody>
													<c:forEach items="${bean.list}" var="news">
														<tr role="row" class="odd">
															<td tabindex="0" class="sorting_1"><a
																href="donews?action=newsread&newsid=${news.id}"
																target="_blank">${news.shopname}</a></td>
															<td>${news.shoporice}</td>
															<td>${news.describe}</td>
															<td>
																<div class="btn-group">
																	<button type="button" class="btn btn-danger">点击操作</button>
																	<button type="button"
																		class="btn btn-danger dropdown-toggle"
																		data-toggle="dropdown" aria-expanded="false">
																		<span class="caret"></span>
																	</button>
																	<ul class="dropdown-menu" role="menu">
																		<li><a class="modifyVersion"
																			href="newsmodify.jsp" data-toggle="tooltip"
																			data-placement="top" title=""
																			data-original-title="修改商品的基本信息">修改商品</a></li>
																		<li><a class="deleteApp"
																			onclick="return delNews(${news.id})"
																			data-toggle="tooltip" data-placement="top" title=""
																			data-original-title="删除商品的基本信息">删除商品</a></li>
																	</ul>
																</div>
															</td>
														</tr>
													</c:forEach>
												</tbody>
											</table>
										</div>
									</div>
									<div class="row">
										<div class="col-sm-5 col-md-5">
											<div class="dataTables_info" id="datatable-responsive_info"
												role="status" aria-live="polite">共${bean.totalCount}条记录${bean.currPageNo}/${bean.totalPageCount}页</div>
										</div>
										<div class="col-sm-7 col-md-7">
											<div class="dataTables_paginate paging_simple_numbers"
												id="datatable-responsive_paginate">
												<ul class="pagination">
													<li class="paginate_button previous"><a
														href="chaxunshangpin?pageno=1&queryTitle=${queryTitle}&ntid=${ntid}"
														aria-controls="datatable-responsive" data-dt-idx="0"
														tabindex="0">首页</a></li>
													<li class="paginate_button"><a
														href="chaxunshangpin?pageno=${bean.currPageNo-1}&queryTitle=${queryTitle}&ntid=${ntid}"
														aria-controls="datatable-responsive" data-dt-idx="1"
														tabindex="0">上一页</a></li>
													<li class="paginate_button"><a
														href="chaxunshangpin?pageno=${bean.currPageNo+1}&queryTitle=${queryTitle}&ntid=${ntid}"
														aria-controls="datatable-responsive" data-dt-idx="1"
														tabindex="0">下一页</a></li>
													<li class="paginate_button next"><a
														href="chaxunshangpin?pageno=${bean.totalPageCount}&queryTitle=${queryTitle}&ntid=${ntid}"
														aria-controls="datatable-responsive" data-dt-idx="7"
														tabindex="0">最后一页</a></li>
													<li><input size="5" type="text" id="inputPage" />
													<button type="button"
															onclick="jump_to(document.getElementById('inputPage').value)">GO</button></li>
													<input type="hidden" id="totalPageCount"
														value="${bean.totalPageCount}" />
												</ul>
											</div>
										</div>
									</div>
								</div>

							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- /page content -->

		<!-- footer content -->
		<footer>
			<div class="pull-right">&copy;明晟科技</div>
			<div class="clearfix"></div>
		</footer>
		<!-- /footer content -->
	</div>

	<!-- jQuery -->
	<script src="../js/jquery-1.12.4.js"></script>
	<!-- Bootstrap -->
	<script src="../js/bootstrap.min.js"></script>
	<!-- FastClick -->
	<script src="../js/fastclick.js"></script>
	<!-- NProgress -->
	<script src="../css/nprogress/nprogress.js"></script>

	<!-- Custom Theme Scripts -->
	<script src="../js/custom.min.js"></script>
	<script type="text/javascript">
		function delNews(nid) {
			var flag = window.confirm("确认要删除吗？");
			if (flag) {
				//进行删除
				window.location.href = "news.do?action=del&nid=" + nid;
				return true;
			}
			return false;
		}
	</script>
</body>
</html>